package org.rednebula.framework.core.service;

import java.util.List;
import java.util.Map;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.rednebula.framework.core.model.PropertyFilter;
import org.springframework.beans.factory.annotation.Autowired;


public  abstract class BasicDbService implements IDbService {

	@Autowired
	protected SessionFactory sessionFactory;

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	/**
	 * 取得当前Session.
	 */
	public Session getSession() {
		return sessionFactory.getCurrentSession();
	}
	
	public int batchExecute(String hql, Object... values) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int batchExecute(String hql, Map<String, Object> values) {
		// TODO Auto-generated method stub
		return 0;
	}

	public void delete(Object entity) {
		// TODO Auto-generated method stub

	}

	public void delete(Object id, Class<?> entityClass) {
		// TODO Auto-generated method stub

	}

	public <X> List<X> find(String hql, Object... values) {
		// TODO Auto-generated method stub
		return null;
	}

	public <X> X findUnique(String hql, Object... values) {
		// TODO Auto-generated method stub
		return null;
	}

	public Object get(Object id, Class<?> entityClass) {
		// TODO Auto-generated method stub
		return null;
	}

	public void save(Object entity) {
		// TODO Auto-generated method stub

	}

	public void update(Object entity) {
		// TODO Auto-generated method stub

	}

	public <X> List<X> find(Class<?> entityClass, List<PropertyFilter> filters) {
		// TODO Auto-generated method stub
		return null;
	}


}
